import { createRouter, createWebHashHistory } from 'vue-router'
import HomePage from '../components/Item/HomePage.vue'
import LoginComponent from '../components//SysUser/LoginComponent.vue'
import ItemDetail from '@/components/Item/ItemDetail.vue'
import HomeView from '../views/HomeView.vue'
import CartPage from '../components/cart/CartPage.vue'
import FavoritesView from '../views/FavoritesView.vue'
import LayOut from '@/components/manager/LayOut.vue'
import GoodsView from '@/components/manager/GoodsView.vue'
import OrderView from '@/components/manager/OrderView.vue'
import UserManager from '@/components/manager/UserManageComponent.vue'
// import OrderDetail from '@/components/manager/OrderDetail.vue'
// import PendingShipmentOrders from '@/components/manager/PendingShipmentOrders.vue'
// import PendingPaymentOrders from '@/components/manager/PendingPaymentOrders.vue'
// import SuccessfulOrders from '@/components/manager/SuccessfulOrders.vue'
// import ClosedOrders from '@/components/manager/ClosedOrders.vue'
// import CompletedOrders from '@/components/manager/CompletedOrders.vue'
// import ShippedOrders from '@/components/manager/ShippedOrders.vue'
import categories from '@/components/manager/CategoryManagement.vue'
import UserPage from '@/components/UserCenter/UserPage.vue'
import OrderPage from '@/components/Item/OrderPage.vue'

const routes = [
  {
    path: '/order/confirm',
    name: 'OrderConfirm',
    component: OrderPage
  },
  {
    path: '/user',
    name: 'user',
    component: UserPage
  },
  {
    path: '/',
    name: 'HomePage',
    component: HomePage
  },
  {
    path: '/login',
    name: 'Login',
    component: LoginComponent
  },
  {
    path: '/product/:id',
    name: 'product',
    component: ItemDetail
  },
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/cart',
    name: 'Cart',
    component: CartPage
  },
  {
    path: '/favorites',
    name: 'FavoritesView',
    component: FavoritesView
  },
  {
    path: '/layout',
    component: LayOut,
    redirect: '/layout/goods',
    children: [
      {
        path: '/layout/goods',
        name: 'Goods',
        component: GoodsView,
        meta: { title: '商品管理', icon: 'shopping-cart' }
      },
      {
        path: '/layout/categories',
        name: 'categories',
        component: categories,
        meta: { title: '分类管理', icon: 'document' }
      },
      {
        path: '/layout/orders',
        name: 'Orders',
        component: OrderView,
        meta: { title: '订单管理', icon: 'document' }
        // children: [
        //   {
        //     path: '/layout/orders/pending-shipment',
        //     name: 'PendingShipmentOrders',
        //     component: PendingShipmentOrders,
        //     meta: { title: '待发货订单', icon: 'document' }
        //   },
        //   {
        //     path: '/layout/orders/pending-payment',
        //     name: 'PendingPaymentOrders',
        //     component: PendingPaymentOrders,
        //     meta: { title: '待付款订单', icon: 'document' }
        //   },
        //   {
        //     path: '/layout/orders/successful',
        //     name: 'SuccessfulOrders',
        //     component: SuccessfulOrders,
        //     meta: { title: '交易成功', icon: 'document' }
        //   },
        //   {
        //     path: '/layout/orders/orderDetail',
        //     name: 'OrderDetail',
        //     component: OrderDetail,
        //     meta: { title: '订单详情', icon: 'document' }
        //   },
        //   {
        //     path: '/layout/orders/closed',
        //     name: 'ClosedOrders',
        //     component: ClosedOrders,
        //     meta: { title: '已关闭订单', icon: 'document' }
        //   },
        //   {
        //     path: '/layout/orders/shipped',
        //     name: 'ShippedOrders',
        //     component: ShippedOrders,
        //     meta: { title: '已发货订单', icon: 'document' }
        //   },
        //   {
        //     path: '/layout/orders/completed',
        //     name: 'CompletedOrders',
        //     component: CompletedOrders,
        //     meta: { title: '已完成订单', icon: 'document' }
        //   }
        // ]
      },
      {
        path: '/layout/usersmanager',
        name: 'Users',
        component: UserManager,
        meta: { title: '用户管理', icon: 'user' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
